<%@ page contentType="text/html; charset=UTF-8" language="java"%>
<%@ include file="/taglibs.jsp"%>
<head>
<meta name="decorator" content="blank">
<title>iobike - Sign Up</title>
</head>

<body>
<div class="embedded-container">
	<div class="plain-logo">
		<%--<h3><a class="brand" href="${ctx}"><strong>yasoo</strong></a></h3> --%>
		<a href="${ctx}"><img alt="Logo-full" src="${ctx}/themes/common/images/iobike_logo_full.png" /></a>
	</div>

	<div class="login">
		<article>
			<form id="signUpform" action="${ctx}/user!signUp.action" validate="true"  method="post">
				<legend><h2><s:text name="button.signIn"/></h2></legend>
				<fieldset>
					<input class="input-block-level string required" id="user_name" name="user.userName"
						placeholder="User name" size="50" type="text" />
					<input class="input-block-level string required email" id="user_email"
						name="user.email" placeholder="Email address" size="50" type="email" value="" />
					<input class="input-block-level password required" id="user_password"
						name="user.password" placeholder="Password" size="50" type="password" />
						<span class="help-block">Must be at least six characters long</span>
				</fieldset>
				<s:submit id="submit" key="button.signUp" cssClass="btn btn-primary btn-large"/>
			</form>
		</article>
		<footer>
			<h4 class="muted">
				Already have an account? <a href="${ctx}/showLoginPage.action">Login now</a>
			</h4>
		</footer>
	</div>
</div>



<script type="text/javascript">

$(document).ready(function() {
    // validate signup form on keyup and submit 
    var validator = $("#signUpform").validate({ 
        rules: { 
		    'user.userName': { 
		        remote:"${ctx}/user!checkUniqueness.action?checkedField=userName"
		    },
		    'user.email': { 
		        remote:"${ctx}/user!checkUniqueness.action?checkedField=email"
		    },
		    'user.password': {
                minlength: 6
            }
        }, 
        messages: {
        	'user.userName': {remote: jQuery.validator.format("<s:text name='error.uniqueConstraint'/>")},
        	'user.email': {remote: jQuery.validator.format("<s:text name='error.uniqueConstraint'/>")}
        }, 
        onkeyup: false
    });
	var support = (function(input) {  
	    return function(attr) { return attr in input; };
	})(document.createElement('input')); 
	if ( !(support('placeholder') && $.browser.webkit) ) { 
	    $("form input").placeholder({//text是使用placeholder的input的类  
	        useNative: false,  
	        hideOnFocus: false,  
	        style: {  
	            textShadow: 'none'  
	        }  
	    });
	}  
	document.all.user_name.focus();
}); 
</script>
</body>

